<?php /* Smarty version 2.6.20, created on 2013-05-25 06:14:10
         compiled from _core/_include/module/_mvc/control/tablerows/handletablerowproduce.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', '_core/_include/module/_mvc/control/tablerows/handletablerowproduce.tpl', 86, false),)), $this); ?>
function HandleTableRowProduce(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._popupBox = new PopupBox();
  this._popupBox2 = new PopupBox2();
  
  this._menu = (options && options.menu) ? options.menu : null;
  this._user = (options && options.user) ? options.user : null;
  this._date = (options && options.date) ? options.date : null;
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : null;

  this._createElements();
};

HandleTableRowProduce.prototype._createElements = function() {
  var a, _self = this;
  
  if (this._item.isCustom == 1) {
    
    this._gui.customer.appendChild(document.createTextNode((this._item.customerId) ? (DlmanageUtils.customerId(this._item.customerId) + this._item.orderFlag) : '-'));
    
    if (!(this._item.completed == 1 || this._item.cancelled == 1)) {
      if (this._item.urgent == 1) {
        var img = document.createElement('img');
        img.src = 'images/common/urgented.png';
        this._gui.name.appendChild(img);
      }
    }
    
    this._gui.name.appendChild(document.createTextNode(this._item.title + ' (' + this._item.owner + ') '));
    
    var note = document.createElement('img');
    note.src = (this._item.v2_notes.length != 0) ? 'images/buttons/note_hilight.png' : 'images/buttons/note.png';
    note.style.cursor = 'pointer';
    note.style.margin = '0 0 0 5px';
    note._produce = this._item;
    note.onclick = function() { var div, pos, func1, func2;
                                var pro = this._produce;
                                div = document.createElement('div');
                                pos = DOMUtils.findPos(this);
                                MiscUtils.dialog(_self._popupBox2, pos, div, null, null, {t: pro.title, width: 760, height: 100});
                                new DialogProduceNote(div, pro, { author: _self._user, now: _self._date, isProduce: true, popupBox: _self._popupBox2, callbackFunc: function() { _self._callbackFunc();} });
                                return false;
                              };
    this._gui.name.appendChild(note);
    
      
    if (this._item.user_type.charAt(0) != '#') {
      this._gui.user.appendChild(document.createTextNode((this._item) ? this._item.user_account + ' (' + this._item.user_type + ')': ''));
    } else {
      this._gui.user.appendChild(document.createTextNode((this._item) ? this._item.user_account + ' (Factory, ' + this._item.user_type.substring(1) + ')': ''));
    }
    
  } else {
    
    if (this._user.type == Constant.USER_TYPE_ACCOUNTANT) {
      this._gui.customer.appendChild(document.createTextNode((this._item.customerId) ? (DlmanageUtils.customerId(this._item.customerId) + this._item.orderFlag) : ''));
    } else {
      a = document.createElement('a');
      a.appendChild(document.createTextNode((this._item.customerId) ? (DlmanageUtils.customerId(this._item.customerId) + this._item.orderFlag) : ''));
      if (this._user.type == Constant.USER_TYPE_MANAGER_ASSISTANT) {
        a.href = '?p=pageasst&t=pagecustomerold&m=' + JSON.stringify({ a: 2, b: 1 }) + '&opts=' + JSON.stringify({ id: this._item.customerId, track: this._item.orderTrackId });
      } else if (this._user.type == Constant.USER_TYPE_CUSTOMER_SERVICE) {
        a.href = '?p=pageserv&t=pagecustomerold&m=' + JSON.stringify({ a: 2, b: 1 }) + '&opts=' + JSON.stringify({ id: this._item.customerId, track: this._item.orderTrackId });
      } else if (this._user.type == Constant.USER_TYPE_MANAGER) {
        a.href = '?p=pagemanager&t=pagecustomerold&m=' + JSON.stringify({ a: 2, b: 1 }) + '&opts=' + JSON.stringify({ id: this._item.customerId, track: this._item.orderTrackId });
      } else {
        a.href = '?p=pageadmin&t=pagecustomerold&m=' + JSON.stringify({ a: 2, b: 1 }) + '&opts=' + JSON.stringify({ id: this._item.customerId, track: this._item.orderTrackId });
      }
      this._gui.customer.appendChild((this._item.customerId != 0) ? a : document.createTextNode('Parcel'));
    }
    
    if (this._item.customerId == 0) {
      this._gui.customer.style.fontWeight = 'bold';
    }
    
    if (!(this._item.completed == 1 || this._item.cancelled == 1)) {
      if (this._item.urgent == 1) {
        var img = document.createElement('img');
        img.src = 'images/common/urgented.png';
        this._gui.name.appendChild(img);
      }
    }
    
    if (this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_VIDEODVD)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_4X6)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_RETOUCH)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_RETOUCH_MAGAZINE)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_COMMON)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
') {
      var span = document.createElement('span');
      span.style.fontWeight = 'bold';
      span.appendChild(document.createTextNode(this._item.pi_quantity + 'X'));
      this._gui.name.appendChild(span);
    }
    this._gui.name.appendChild(document.createTextNode(this._item.title));
    
    if (this._item.pi_model == Constant.MODEL_NAME_USER_PHOTOGRAPHER) {
      if (this._item.pi_selects.length == 1) {
        if (this._item.pi_selects[0].value != '0' && this._item.pi_selects[0].value != '') {
          this._gui.name.appendChild(document.createTextNode(' + ' + this._item.pi_selects[0].value + ' ' + this._item.pi_selects[0].title + 's'));
        }
      }
    }
    if (this._item.pi_selects.length > 0 && (this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_VIDEODVD)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_4X6)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_RETOUCH)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_RETOUCH_MAGAZINE)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_PRODUCT_COMMON)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
' ||
        this._item.pi_model == '<?php echo ((is_array($_tmp=@MODEL_NAME_ALBUM_DESIGN)) ? $this->_run_mod_handler('escape', true, $_tmp, 'javascript') : smarty_modifier_escape($_tmp, 'javascript')); ?>
')) {
      a = document.createElement('a');
      a.href = '#';
      a.style.fontSize = '10px';
      a.appendChild(document.createTextNode('Info'));
      a.onclick = function() { var func1 = function() { _self._popupBox2._close(); };
                               var div = document.createElement('div');
                               MiscUtils.dialog(_self._popupBox2, DOMUtils.findPos(this), div, func1, null, {t: _self._item.title, width: 510, height: 100});
                               new DialogDetails(div, _self._item, { orderId: _self._item.orderId, hidePrice: _self._options.hidePrice});
                               return false;
                             };
      this._gui.name.appendChild(a);
    }
    
    var note = document.createElement('img');
    note.src = (this._item.v2_notes.length != 0) ? 'images/buttons/note_hilight.png' : 'images/buttons/note.png';
    note.style.cursor = 'pointer';
    note.style.margin = '0 0 0 5px';
    note._produce = this._item;
    note.onclick = function() { var div, pos, func1, func2;
                                var pro = this._produce;
                                div = document.createElement('div');
                                pos = DOMUtils.findPos(this);
                                MiscUtils.dialog(_self._popupBox2, pos, div, null, null, {t: pro.title, width: 760, height: 100});
                                new DialogProduceNote(div, pro, { author: _self._user, now: _self._date, popupBox: _self._popupBox2, callbackFunc: function() { _self._callbackFunc();} });
                                return false;
                              };
    this._gui.name.appendChild(note);
    
    this._gui.user.appendChild(document.createTextNode(this._item.user_account));
  }
  
  var gui = GuiProduce.instance(this._gui.task, this._gui.dateline, this._gui.progress);
  new HandleProduce(gui, this._item, this._options);
};